home *** CD-ROM | disk | FTP | other *** search
- Path: charm.il.ft.hse.nl!not-for-mail
- From: robert@il.ft.hse.nl (robert)
- Newsgroups: comp.lang.c
- Subject: Re: Type casting
- Date: 23 Feb 1996 15:56:01 +0100
- Organization: LSD...melts in your mind, not in your hand
- Message-ID: <4gkki1$a7c@charm.il.ft.hse.nl>
- References: <4gfnmi$gsc@calvin.risq.qc.ca> <4gim30INNo4b@keats.ugrad.cs.ubc.ca>
- NNTP-Posting-Host: charm.il.ft.hse.nl
-
- c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku):
- >In article <4gfnmi$gsc@calvin.risq.qc.ca>,
- >Pierre Coulombe <pcoulomb@criq.qc.ca> wrote:
- >> char string[80];
- >> strcpy(string, "25.4");
- >Try char *string = "25.4". This is a waste.
- >> sprintf(string, "%f", (float) atof(string) * MM_TO_UNITS);
- ^^^^^^
- It's not a waste, you can't be certain the result will fit in the 4
- chars.
-
- robert
-